package com.labofjet.job;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

import com.labofjet.service.TestService;
import com.labofjet.util.SpringContextUtils;

@Component
public class TestQuartzJob extends QuartzJobBean {
	
	private static Lock lock = new ReentrantLock();

	@Override
	protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
		lock.lock();
		try {
			Thread.sleep(3000);
		} catch (Exception e) {
			e.printStackTrace();
		}
		System.out.println(this.toString() + SpringContextUtils.getBean(TestService.class));
		
		lock.unlock();
	}

}
